package 多线程.TheadPoolManager;

import sun.nio.ch.ThreadPool;

import java.lang.reflect.Proxy;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.*;

/**
 * @author : K k
 * @date : 9:49 2020/9/30
 */
public class ExecutorDemo {

    public static void main(String[] args) {
        ExecutorService service=Executors.newFixedThreadPool(1);
        Future<Integer> hello = service.submit(new Callable<Integer>() {
            @Override
            public Integer call() throws Exception {
                int i=2;
                return i;
            }
        });

        try {
            int o = hello.get();
            service.shutdownNow();
            System.out.println(o);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }

    }
}
